Home | Miscellaneous | Pi | Set Address
Charles Varvayanis
Computer and Communication Systems

Since 1990
(209) 586-3782
charles@varvayanis.com
How to Set Raspberry Pi IP Address
Step-by-step instructions for setting the Raspberry Pi IP Address.
These procedures apply to Raspberry Pi 5, 4 or 3 with Raspberry Pi OS (64-Bit), (32-Bit) or (Legacy, 32-Bit).
General Notes
1. General:
The procedures below are optimized for determining the IP Address of a Raspberry Pi 5, 4 or 3 with Raspberry Pi OS (64-Bit), (32-Bit) or (Legacy, 32-Bit).
2. Internet access during setup:
Many of the steps below assume and require the target Raspberry Pi is connected to a network with access to the Internet.
Notice about updates, upgrades and installations failing due to repository or network congestion or outages
Occasionally updates, upgrades and installations fail due to repository or network congestion or outages.
Sometimes there is an appropriate message saying as such, sometimes a missing file is reported, and sometimes there is just a failure message without an explanation.
When this occurs, simply run the command again.
If that does not solve the issues immediately, try again later.
Connect to the target Raspberry Pi
Connect to the target Raspberry Pi using Raspberry Pi Connect Remote shell or Raspberry Pi Connect Screen share and open a Terminal window.
https://www.raspberrypi.com/software/connect
- or -
Connect directly to the target Raspberry Pi via a Display, Keyboard and Mouse, then open a Terminal window.
- or -
Use SSH via a tool such as PuTTY to connect to the Raspberry Pi.
https://putty.software/
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
https://www.putty.org
Connect using the IP address or URL of the target Raspberry Pi.
Note: The first time a connection is made, a security warning may be displayed | Yes
For using SSH above, determine the target Raspberry Pi IP Address:
Use an IP Scanner tool such as Advanced IP Scanner on a PC or alike to locate the DHCP IP Address assigned to the Raspberry Pi.
https://www.advanced-ip-scanner.com
- or -
Connect directly to the target Raspberry Pi via a Display, Keyboard and Mouse, then open a Terminal window.
sudo hostname -I
- or -
Connect to the target Raspberry Pi using Raspberry Pi Connect Remote shell or Raspberry Pi Connect Screen share and open a Terminal window.
sudo hostname -I
- or -
Login to your router and examine the DHCP assignments, sometimes labeled "Connected Devices" or similar.
Update Raspberry Pi OS and Components
Download latest package lists
sudo apt-get update -y
Download and install updated listed packages
sudo apt-get upgrade -y
Change the Raspberry Pi IP address and network settings using the Rasberry Pi Desktop Interface (GUI), NetworkManager User Interface (UI), or Command Line Interface (CLI)
Note: While the steps below are specific to setting the IP Address of the Ethernet Port, they can be used for setting the IP Address of a Wi-Fi connection by substituting the references to "Wired Connection 1" with your Wi-Fi Connection.
Update Raspberry Pi OS and Components
Download latest package lists
sudo apt-get update -y
Download and install updated listed packages
sudo apt-get upgrade -y
Enable NetworkManager on Raspberry Pi OS (Legacy) only. Note: NetworkManager is already enabled by default on Raspberry Pi OS (64-bit) and (32-Bit).
Enable NetworkManager
sudo raspi-config
Advance Options | [Enter] | Network Config | [Enter] | NetworkManager | [Enter] | OK | [Enter] | Finish | [Enter] | Would you like to reboot now? | Yes | [Enter]
Note 1: The DHCP assigned IP Address of the Raspberry Pi may change and need to be located again.
Note 2: The TeamViewer ID of the Raspberry Pi may change and need to be obtained again.
Note: The Subnetwork Mask is expressed in Slash Notation along with an IP Address in certain areas of this section.
Network Subnetwork Mask and Slash Notation Relationships
| Class | Mask | Slash | Nodes |
| A | 255.000.000.000 | /8 | 16777214 |
| B | 255.255.000.000 | /16 | 65534 |
| B | 255.255.128.000 | /17 | 32766 |
| B | 255.255.192.000 | /18 | 16382 |
| B | 255.255.224.000 | /19 | 8190 |
| B | 255.255.240.000 | /20 | 4094 |
| B | 255.255.248.000 | /21 | 2046 |
| B | 255.255.252.000 | /22 | 1022 |
| B | 255.255.254.000 | /23 | 510 |
| C | 255.255.255.000 | /24 | 254 |
| C | 255.255.255.128 | /25 | 126 |
| C | 255.255.255.192 | /26 | 62 |
| C | 255.255.255.224 | /27 | 30 |
| C | 255.255.255.240 | /28 | 14 |
| C | 255.255.255.248 | /29 | 6 |
| C | 255.255.255.252 | /30 | 2 |
| C | 255.255.255.254 | /31 | 0 |
| C | 255.255.255.255 | /32 | 0 |
Change the Raspberry Pi IP address and network settings using the Rasberry Pi GUI (Desktop)
Click on the two arrows facing up and down on the right side of the Task Bar at the top of the Raspberry Pi desktop
Click on "Advanced Options" | "Edit Connections..."
Doubke Click on "Ethernet" | "Wired connection 1"
Click on the "IPv4 Settings" Tab
Click on these fields to edit them:
"Method" | Manual
"Address"
(Your Rspbrry Pi IP Address)
Example:
192.168.0.25
"Netmask"
(See the section above "The Subnetwork Mask is expressed in Slash Notation...")
Example:
/24
"Gateway"
(Typicaly the network router LAN IP Address)
Example:
192.168.0.1
"DNS servers"
(Use commas to seperate multiple domain name server addresses)
Example:
8.8.8.8,8.8.4.4
Click on the "Save" Button
X out of the "Network Connections" window
- or -
Change the Raspberry Pi IP address and network settings using the NetworkManager User Interface (UI)
Open the NetworkManager User Interface (UI)
sudo nmtui
Edit a connection | [Enter] | Wired Connection 1 | [Enter]
Change these fields (Note: Use [Tab] to move around the window, [Enter] to select, and [Esc] to back out of a window):
IPv4 CONFIURATION | <Automatic> | [Enter] | Manual | [Enter] | <Show> | [Enter]
Addresses | <Add...> | [Enter] | <YourRaspberryPiIPAddress>/<YourNetworkSubnetworkMask> (The Subnetwork Mask is expressed in Slash Notation along with the IP Address) - Example: 192.168.0.25/24 | [Enter]
Gateway | <YourNetworkDefaultGatewayIPAddress> (Typicaly the network router LAN IP Address) - Example: 192.168.0.1 | [Enter]
DNS Servers | <Add...> | [Enter] | <DNSServer1> - Example: 8.8.8.8 | [Enter]
DNS Servers | <Add...> | [Enter] | <DNSServer2> - Example: 8.8.4.4 | [Enter]
OK | [Enter] (Note: [Tab] to bottom of the window)
[Esc] | [Esc]
Restart the connection to begin using the new settings
sudo nmcli con up "Wired connection 1"
- or -
Change the Raspberry Pi IP address and network settings using NetworkManager Command Line Interface (CLI)
Show all network connections
sudo nmcli con show
Note: "Wired connection 1" is the default Ethernet connection name and is assumed in the following commands.
Set IP Address
sudo nmcli con mod "Wired connection 1" ipv4.addresses <YourRaspberryPiIPAddress>/<YourNetworkSubnetworkMask> (The Subnetwork Mask is expressed in Slash Notation along with the IP Address)
Example:
sudo nmcli con mod "Wired connection 1" ipv4.addresses 192.168.0.25/24
Set the Gateway Address
sudo nmcli con mod "Wired connection 1" ipv4.gateway <YourNetworkDefaultGatewayIPAddress> (Typicaly the Gateway Address is network router LAN IP Address)
Example:
sudo nmcli con mod "Wired connection 1" ipv4.gateway 192.168.0.1
Set the DNS Servers
sudo nmcli con mod "Wired connection 1" ipv4.dns "<DNSServer1> <DNSServer2> <DNSServer...>" (Use spaces to seperate multiple domain name server addresses)
Example:
sudo nmcli con mod "Wired connection 1" ipv4.dns "8.8.8.8 8.8.4.4"
Set the Addressing Mode to Manual (Static)
sudo nmcli con mod "Wired connection 1" ipv4.method manual
Restart the connection to begin using the new settings
sudo nmcli con up "Wired connection 1"
For testing - Display the IP Address, Gateway, DNS Servers and Addressing Mode (Optional)
sudo nmcli -g ip4.address,ipv4.gateway,ip4.dns,ipv4.method connection show "Wired connection 1"
For testing - Display the profile so all parameters can be reviewed (Optional)
sudo nmcli -p con show "Wired connection 1"
Remove packages that were automatically installed and are no longer required
Occasionally excess update, upgrade and installation packages install automatically, but are no longer required and can be removed automatically.
Automatically detect and remove packages no longer required
sudo apt autoremove -y
Charles Varvayanis
Sonora, CA 95370
e-mail: charles@varvayanis.com
Phone: (209) 586-3782
Fax: (209) 586-3761
Business Card (PDF 153 KB) 
www.varvayanis.com

© 2025 Charles Varvayanis
All rights reserved